package com.example.microinvestmarket.Runnable;
import com.example.microinvestcommon.util.StockCodeRandomNumberAssignerUtil;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class RandomStockNumberRunnable implements Runnable{

    private static final List<String> stockNumberList = Collections.synchronizedList(new ArrayList<>());

    @Override
    public void run() {

        String stockNumber=StockCodeRandomNumberAssignerUtil.generateRandomCode();
        stockNumberList.add(stockNumber);

    }

    // 返回不可修改的列表视图，防止外部修改
    public static List<String> getStockNumberList() {
        return new ArrayList<>(stockNumberList);
    }

    // 新增：清空股票名称列表的方法
    public static void clearStockNumberList() {
        stockNumberList.clear();
    }
}
